#!/bin/bash
HOOK_NAMES="
applypatch-msg
pre-applypatch
post-applypatch
pre-commit
prepare-commit-msg
commit-msg
post-commit
pre-rebase
post-checkout
post-merge
pre-receive
update
post-receive
post-update
pre-auto-gc
"

HOOK_SRC=$(dirname $0)
HOOK_DIR=$(git rev-parse --git-dir)/hooks || exit $?

for hook in $HOOK_NAMES; do
    if [ ! -h $HOOK_DIR/$hook -a -x $HOOK_DIR/$hook ]; then
        mv $HOOK_DIR/$hook $HOOK_DIR/$hook.local
    fi
    ln -s -f ../../git/hooks-wrapper $HOOK_DIR/$hook
done
